package orign

import (
	"fmt"
	"io/ioutil"
	"net/http"
)

func sayHello(w http.ResponseWriter, r *http.Request) {
	bytes, e := ioutil.ReadFile("./index.html")
	if e != nil {
		fmt.Fprint(w, "hello go http server")
	} else {
		fmt.Fprint(w, string(bytes))
	}

}
func StartOriginHttpServer() {
	http.HandleFunc("/", sayHello)
	fmt.Println("服务器启动成功，地址: http://localhost:9090 ")
	err := http.ListenAndServe(":9090", nil)
	if err != nil {
		fmt.Printf("http服务器启动发生错误: %v", err)
	}
}
